#ifndef Echo_h
#define Echo_h

#include "WProgram.h"
#include <MIDI.h>

class Echo {
  public:
    Echo(MIDI * midi);
    void readFromSerial();
    void writeToSerial();
    void readFromMemory(int index);
    void writeToMemory(int index);
    void handleNoteOn();
    void handleNoteOff();
    void sync();
  private:
    MIDI *midi;
    int time;
    int feedback;
    int notes[32][5];
    long notelengths[32];
    long notetime[32];
    int notec;
    int syncc;
    int hold[32];
    int holdc;
    int echo[32];
    long echotime[32];
    int echoc;
    boolean midisync;
};

#endif
